package com.tb.shoop.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.tb.v1.api.shoop.ISpUserService;
import com.tb.v1.api.vo.SpUserVo;
import com.tb.v1.entity.SpUser;
import com.tb.v1.result.ResultJson;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

/**
 * @author: tangBin
 * @Date: 2020/7/10 0010 16:22
 * @Description:
 */
@Slf4j
@RequestMapping("/v1")
@RestController
public class SpUserController extends BaseController {

    @Reference
    private ISpUserService spUserService;

    @RequestMapping("/user")
    public ResultJson<Object> getUser(@RequestBody SpUserVo vo) {
        //log.info("name={0}==,pwd={1}",name,pwd);
        Map map = new HashMap();
        map.put("username", vo.getName());
        map.put("password", vo.getPwd());
        SpUser user = spUserService.getUser(map);
        return toResultModel("200", "成功", user);
    }
}
